/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.inv.controller;

import java.util.List;
import java.util.Map;

import com.dian.common.annotation.SysLog;
import com.dian.common.repeat.NoRepeatSubmit;
import com.dian.modules.sale.vo.ProbHeadExportVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.dian.common.controller.AbstractController;
import com.dian.modules.inv.entity.InHeadEntity;
import com.dian.modules.inv.service.InHeadService;
import com.dian.common.utils.PageUtils;
import com.dian.common.utils.R;

/**
 * 入库单
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-11 00:12:45
 */
@RestController
@Api("入库单接口")
@RequestMapping("inv/inHead")
public class InHeadController extends AbstractController{
    @Autowired
    private InHeadService inHeadService;

    /**
     * 入库单列表
     */
    @SysLog("入库单列表")
    @GetMapping("/list")
    @ApiOperation("入库单列表")
    @RequiresPermissions("inv:inHead:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inHeadService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 入库单信息
     */
    @SysLog("入库单信息")
    @ApiOperation("入库单信息")
    @GetMapping("/info/{id}")
    @RequiresPermissions("inv:inHead:info")
    public R info(@PathVariable("id") Long id){
		InHeadEntity inHead = inHeadService.getInfo(id);

        return R.ok().put("inHead", inHead);
    }

    /**
     * 入库单保存
     */
    @SysLog("入库单保存")
    @NoRepeatSubmit
    @ApiOperation("入库单保存")
    @PostMapping("/save")
    @RequiresPermissions("inv:inHead:save")
    public R save(@RequestBody InHeadEntity inHead){

		inHeadService.saveInfo(inHead);

        return R.ok();
    }

    /**
     * 入库单修改
     */
    @SysLog("入库单修改")
    @NoRepeatSubmit
    @ApiOperation("入库单修改")
    @PostMapping("/update")
    @RequiresPermissions("inv:inHead:update")
    public R update(@RequestBody InHeadEntity inHead){

		inHeadService.updateInfo(inHead);

        return R.ok();
    }

    /**
     * 入库单删除
     */
    @SysLog("入库单删除")
    @ApiOperation("入库单删除")
    @GetMapping("/delete/{id}")
    @RequiresPermissions("inv:inHead:delete")
    public R delete(@PathVariable("id") Long id){
		inHeadService.deleteInfo(id);

        return R.ok();
    }

    /**
     * 入库单审核
     */
    @NoRepeatSubmit
    @SysLog("入库单审核")
    @ApiOperation("入库单审核")
    @GetMapping("/check/{id}")
    @RequiresPermissions("inv:inHead:check")
    public R check(@PathVariable("id") Long id){
        inHeadService.checkInfo(id);
        return R.ok();
    }

   /* *//**
     * 预订单导出
     *//*
    @SysLog("入库单导出")
    @ApiOperation("入库单导出")
    @GetMapping("/export")
    @RequiresPermissions("inv:inHead:export")
    public void export(@RequestParam Map<String, Object> params){
        List<InHeadEntity> list = inHeadService.exportList(params);
        exportExcel(list,"预订单","预订单",ProbHeadExportVO.class,"预订单.xls");
    }*/


}
